﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;
using System.Data.SqlClient;

namespace ERPForms
{
    public partial class GestionariFrm : FrmRezumat
    {
        /// <summary>
        /// Daca este setata Denumire, macheta intra in adaugare cu denumirea completata
        /// </summary>
        private String _denumire = String.Empty;
        public String Denumire
        {
            set
            {
                _denumire = value.ToUpper();
            }
        }


        public GestionariFrm(ModuleClass mc):base(mc)
        {
            InitializeComponent();
            workConnString = mc.workConnectionString;
        }

        private void GestionariFrm_Load(object sender, EventArgs e)
        {
            if (_denumire != String.Empty)
            {
                eSRPDataSet.Gestionari.NumePrenumeColumn.DefaultValue = _denumire;
                gestionariDGV.AllowUserToAddRows = false;
            }
            SqlConnection conn = DeschideConexiune(workConnString);
            this.gestionariTableAdapter.Connection = conn;
            this.gestionariTableAdapter.Fill(this.eSRPDataSet.Gestionari);
            InchideConexiune(conn);

            AddBindingSource(gestionariBindingSource);
            AddTableAdaptor(gestionariTableAdapter.Adapter);

            if (_denumire != String.Empty)
                Adauga(this, null);

        }
    }
}
